<?php

namespace App\Support;

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;

/**
 * Helper
 * 帮助类
 *
 * @category Helper
 * @package  LaravelAdmin
 * @author   Gurudin <hc.gaoxiang@gmail.com>
 * @license  https://github.com/gurudin/laravel-admin/blob/master/LICENSE MIT
 * @link     https://github.com/gurudin/laravel-admin
 */
class Helper
{
    /**
     * Is admin
     *
     * @return bool
     */
    public static function isAdmin()
    {
        return in_array(Auth::user()->email, config('admin.admin_email'))
            ? true
            : false;
    }

    /**
     * Remove cache
     *
     * @param string $key Cache key
     *
     * @return void
     */
    public static function removeCache(string $key)
    {
        Cache::forget($key);
    }

    /**
     * Get menu.
     *
     * @return array
     */
    public static function getMenu()
    {
        $menus = config('admin.menus');
        
        return $menus;
    }
}
